package com.leyuangame.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * redis集群版的实现类
 * @author L
 *
 */
public class JedisClientCluster implements JedisClient {

	@Resource
	private JedisCluster jedisCluster;
	
	@Override
	public String set(String key, String value) {
		return jedisCluster.set(key, value);
	}

	@Override
	public String get(String key) {
		return jedisCluster.get(key);
	}

	@Override
	public Long hset(String key, String item, String value) {
		return jedisCluster.hset(key, item, value);
	}

	@Override
	public String hget(String key, String item) {
		return jedisCluster.hget(key, item);
	}

	@Override
	public Long incr(String key) {
		return jedisCluster.incr(key);
	}

	@Override
	public Long decr(String key) {
		return jedisCluster.decr(key);
	}

	@Override
	public Long expire(String key, int second) {
		return jedisCluster.expire(key, second);
	}

	@Override
	public Long ttl(String key) {
		return jedisCluster.ttl(key);
	}

	@Override
	public Long hdel(String key, String item) {
		return jedisCluster.hdel(key, item);
	}

	@Override
	public Long del(String key) {
		return jedisCluster.del(key);
	}

	@Override
	public Boolean exists(String key) {
		return jedisCluster.exists(key);
	}

	@Override
	public Long lpush(String key, String... string) {
		return jedisCluster.lpush(key,string);
	}

	@Override
	public Long llen(String key) {
		return jedisCluster.llen(key);
	}

	@Override
	public List<String> lrange(String key, Long begin, Long end) {
		return jedisCluster.lrange(key,begin,end);
	}

	public Long sadd(String key, String... string){
		return jedisCluster.sadd(key,string);
	}

	public Set<String> smembers(String key){
		return jedisCluster.smembers(key);
	}

    @Override
    public Long srem(String key, String... members) {
        return jedisCluster.srem(key,members);
    }
}
